package cn.nfwx.tv.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import cn.nfwx.tv.R;
import cn.nfwx.tv.model.TvProgram;
import cn.nfwx.tv.util.GlideUtil;

public class NyqfProgramAdapter extends BaseQuickAdapter<TvProgram, BaseViewHolder> {
    public NyqfProgramAdapter() {
        super(R.layout.item_nyqf_video);
    }

    @Override
    protected void convert(BaseViewHolder helper, TvProgram item) {
        helper.setVisible(R.id.tv_item_nyqf_time, false);
        helper.setText(R.id.tv_item_nyqf_title, item.getProgram_name());
        String url = item.getUrl();
        int lastIndex = url.lastIndexOf(".");
        url = url.substring(0, lastIndex) + ".jpg";
        GlideUtil.loadImage(mContext, url, (ImageView) helper.getView(R.id.iv_item_nyqf_videoimg));
        helper.addOnClickListener(R.id.fl_item_nyqf_video);
    }
}
